Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

got-unwrapped: init at 0.100; got: wrap got-unwrapped with ssh #322202

Closed
wants to merge 1 commit into from
Closed

got-unwrapped: init at 0.100; got: wrap got-unwrapped with ssh #322202

wants to merge 1 commit into from

Conversation

eclairevoyant
Copy link
Contributor

@eclairevoyant eclairevoyant commented Jun 24, 2024

Description of changes

Created as an alternative to #297154 to prevent superfluous rebuilds.
TBH I'm not a big fan of this approach, a rebuild takes a few seconds, and this increases maintenance burden, but this does address the comments on the previous PR.

Fixes #322043.
Closes #297154.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@afh
Copy link
Member

afh commented Jun 25, 2024

Thanks for this, @eclairevoyant, very much appreciated. Currently I'm a bit confused by the naming—not that there is anything wrong with it per se, could just be my current understanding of nixpkgs best practices.

The help clear this up, @eclairevoyant, could you provide more context or explanation around the motivation to call the "original"/"unmodified" package that offers no "customization" of ssh in got got-unwrapped and the one that does got?

Is it just because the "new" got is a wrapper around the "old" one?

@eclairevoyant
Copy link
Contributor Author

eclairevoyant commented Jun 25, 2024

It's how every other wrapped package I've seen is named. See nvim, mpv, sway, etc.

@afh
Copy link
Member

afh commented Jun 25, 2024

The more I go over this, the more I'm beginning to understand, and starting to really liking the change, @eclairevoyant, very well done!

Prior to review just a minor question more out of interest than anything else:
What is the motivation / pro / con for patching the source over using substituteInPlace in package.nix to replace execv(GOT_DIAL_PATH_SSH with execvp(GOT_DIAL_PATH_SSH in lib/dial.c?

@eclairevoyant
Copy link
Contributor Author

I don't have a strong opinion either way; I can switch it to substituteInPlace if that's easier to maintain.

Copy link
Contributor

@wahjava wahjava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're also overridding GOT_TAG_PATH_SSH_KEYGEN could you patch its use to execvp as well.

And similarly there is occurence for /usr/bin/signify (and /usr/bin/vi). Maybe we can patch that (those) too ?

Thanks!

@afh
Copy link
Member

afh commented Jun 25, 2024

I think that substituteInPlace provides more flexibility if upstream changes the code around the execv calls; a patch is likely to fail just because some surrounding code changes, e.g. added or deleted lines in the source file that do not directly affect the execv call…

@eclairevoyant
Copy link
Contributor Author

Didn't notice those earlier. I find that it's weird that they hardcode the editor at build-time instead of using an envvar with a default of vi or something.

@eclairevoyant
Copy link
Contributor Author

Yeah nvm I think this is just the completely wrong approach

@eclairevoyant eclairevoyant deleted the got-ssh-fix branch June 25, 2024 21:26
@afh
Copy link
Member

afh commented Jun 25, 2024

Thanks for the work on this, @eclairevoyant, too bad this doesn't seem to head in the right direction for you.
What would be a better approach? Is this something that is better raised and addressed upstream?

@eclairevoyant
Copy link
Contributor Author

If they're just shelling out, this is something best handled at runtime via some envvar, not via buildtime #define. And yes upstream would be best to address this IMO

@afh
Copy link
Member

afh commented Jun 26, 2024

ℹ️ It seems the changes introducing GOT_DEFAULT_EDITOR were motivated by someone thinking of NixOS (see https://marc.gameoftrees.org/mail/1710762601.52948_0.html)

@eclairevoyant
Copy link
Contributor Author

eclairevoyant commented Jun 26, 2024

There's really no reason that they should require users to recompile got, just to use another editor. It's a bad design.

git does the sensible thing and reads VISUAL or EDITOR envvars by default.

@afh
Copy link
Member

afh commented Jun 26, 2024

got does indeed check and use the VISUAL and EDITOR envvars (see cvg/cvg.c:275f), only its default editor is hardcoded, which I believe make sense to change for nixpkgs if people so desire.

How about continuing the conversation over on #322600, @eclairevoyant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

got: ssh not found
3 participants